import { listRadioStationShow,listShowDiscuss,handleDelRadioStationShow,listLableByType,handleAddRadioStationShow } from '../services/show';

export default {
  /*namespace 是 model state 在全局 state 所用的 key，state 是默认数据*/
  namespace: 'show',

  state: {

  },

  effects: {
    /*call 和 put 都是 redux-saga 的 effects，call 表示调用异步函数，put 表示 dispatch action，*/
    /**
     * 展示电台秀
     * @param payload
     * @param callback
     * @param call
     * @param put
     */
    *listRadioStationShow({ payload,callback }, { call, put }) {
      const response = yield call(listRadioStationShow, payload);
      if (callback) callback(response);
    },
    /**
     * 删除电台秀
     * @param payload
     * @param callback
     * @param call
     * @param put
     */
    *handleDelRadioStationShow({ payload,callback }, { call, put }) {
      const response = yield call(handleDelRadioStationShow, payload);
      if (callback) callback(response);
    },
    *handleAddRadioStationShow({ payload,callback }, { call, put }) {
      const response = yield call(handleAddRadioStationShow, payload);
      if (callback) callback(response);
    },
    /**
     * 获取系统标签
     * @param payload
     * @param callback
     * @param call
     * @param put
     */
    *listLableByType({ payload,callback }, { call, put }) {
      const response = yield call(listLableByType, payload);
      if (callback) callback(response);
    },

  },
  /*reducer 是唯一可以更新 state 的地方，接收参数 state 和 action，返回新的 state，*/
  reducers: {

  },
};
